package com.api.Fallback;

import com.api.CartClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author: LiuLi
 * @Date: 2025/09/04 10:47
 * @Description:
 */
@Slf4j
@Component
public class CartClientFallback implements FallbackFactory<CartClient> {
    @Override
    public CartClient create(Throwable cause) {
        return new CartClient() {
            @Override
            public void deleteCartItemByIds(List<Long> ids) {
                log.error("删除购物车商品失败", cause);
                throw new RuntimeException("删除购物车商品失败", cause);
            }
        };
    }
}
